//
//  KSTableView.h
//  BasketBallLeagues
//
//  Created by kenshin on 4/25/17.
//  Copyright © 2017 kenshin. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "KSListViewDataSource.h"

@protocol KSListViewDelegate <UITableViewDataSource, UITableViewDelegate>

@optional

/// 下拉刷新操作
- (void)setHeaderRefreshingBlock:(void(^)())refreshingBlock;

/// 上拉加载操作
- (void)setFooterRefreshingBlock:(void(^)())refreshingBlock;

/// 请求结束，结束刷新操作
- (void)endRefreshing;

/// 无更多数据，结束刷新操作
- (void)endRefreshingWithNoMoreData;

/// 显示错误视图
- (void)showErrorView:(NSError *)error setRetryBlock:(void(^)())retryBlock;

/// 隐藏错误视图
- (void)hideErrorView;

/// 显示错误信息提示
- (void)showErrorToast:(NSError *)error;

@end


@interface KSTableView : UITableView

@property (nonatomic, weak) id<KSListViewDelegate> pagingListDelegate;
@property (nonatomic, weak) id<KSListViewDataSource> pagingListDataSource;
@property (nonatomic, strong, readonly) NSMutableArray *dataItems;
@property (nonatomic, copy) void (^reloadDataBlock)(BOOL isFirstPage);

@end
